home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / select.man < prev    next >
Encoding:
Text File  |  1989-02-24  |  5.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4. SELECT                C Library Procedures                 SELECT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      select - synchronous I/O multiplexing
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  13.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  14.  
  15.      nnffoouunndd == sseelleecctt((nnffddss,, rreeaaddffddss,, wwrriitteeffddss,, eexxcceeppttffddss,, ttiimmeeoouutt))
  16.      iinntt nnffoouunndd,, nnffddss;;
  17.      ffdd__sseett **rreeaaddffddss,, **wwrriitteeffddss,, **eexxcceeppttffddss;;
  18.      ssttrruucctt ttiimmeevvaall **ttiimmeeoouutt;;
  19.  
  20.      FFDD__SSEETT((ffdd,, &&ffddsseett))
  21.      FFDD__CCLLRR((ffdd,, &&ffddsseett))
  22.      FFDD__IISSSSEETT((ffdd,, &&ffddsseett))
  23.      FFDD__ZZEERROO((&&ffddsseett))
  24.      iinntt ffdd;;
  25.      ffdd__sseett ffddsseett;;
  26.  
  27. DDEESSCCRRIIPPTTIIOONN
  28.      _S_e_l_e_c_t examines the I/O descriptor sets whose addresses are
  29.      passed in _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s to see if some of
  30.      their descriptors are ready for reading, are ready for writ-
  31.      ing, or have an exceptional condition pending, respectively.
  32.      The first _n_f_d_s descriptors are checked in each set; i.e. the
  33.      descriptors from 0 through _n_f_d_s-1 in the descriptor sets are
  34.      examined.  On return, _s_e_l_e_c_t replaces the given descriptor
  35.      sets with subsets consisting of those descriptors that are
  36.      ready for the requested operation.  The total number of
  37.      ready descriptors in all the sets is returned in _n_f_o_u_n_d.
  38.  
  39.      The descriptor sets are stored as bit fields in arrays of
  40.      integers.  The following macros are provided for manipulat-
  41.      ing such descriptor sets: _F_D__Z_E_R_O(&_f_d_s_e_t) initializes a
  42.      descriptor set _f_d_s_e_t to the null set.  _F_D__S_E_T(_f_d, &_f_d_s_e_t)
  43.      includes a particular descriptor _f_d in _f_d_s_e_t.  _F_D__C_L_R(_f_d,
  44.      &_f_d_s_e_t) removes _f_d from _f_d_s_e_t.  _F_D__I_S_S_E_T(_f_d, &_f_d_s_e_t) is
  45.      nonzero if _f_d is a member of _f_d_s_e_t, zero otherwise.  The
  46.      behavior of these macros is undefined if a descriptor value
  47.      is less than zero or greater than or equal to _F_D__S_E_T_S_I_Z_E,
  48.      which is normally at least equal to the maximum number of
  49.      descriptors supported by the system.
  50.  
  51.      If _t_i_m_e_o_u_t is a non-zero pointer, it specifies a maximum
  52.      interval to wait for the selection to complete.  If _t_i_m_e_o_u_t
  53.      is a zero pointer, the select blocks indefinitely.  To
  54.      affect a poll, the _t_i_m_e_o_u_t argument should be non-zero,
  55.      pointing to a zero-valued timeval structure.
  56.  
  57.      Any of _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s may be given as zero
  58.      pointers if no descriptors are of interest.
  59.  
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 15, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SELECT                C Library Procedures                 SELECT
  71.  
  72.  
  73.  
  74. RREETTUURRNN VVAALLUUEE
  75.      _S_e_l_e_c_t returns the number of ready descriptors that are con-
  76.      tained in the descriptor sets, or -1 if an error occurred.
  77.      If the time limit expires then _s_e_l_e_c_t returns 0.  If _s_e_l_e_c_t
  78.      returns with an error, including one due to an interrupted
  79.      call, the descriptor sets will be unmodified.
  80.  
  81. EERRRROORRSS
  82.      An error return from _s_e_l_e_c_t indicates:
  83.  
  84.      [EBADF]        One of the descriptor sets specified an
  85.                     invalid descriptor.
  86.  
  87.      [EINTR]        A signal was delivered before the time limit
  88.                     expired and before any of the selected events
  89.                     occurred.
  90.  
  91.      [EINVAL]       The specified time limit is invalid.  One of
  92.                     its components is negative or too large.
  93.  
  94. SSEEEE AALLSSOO
  95.      accept(2), connect(2), read(2), write(2), recv(2), send(2),
  96.      getdtablesize(2)
  97.  
  98. BBUUGGSS
  99.      Although the provision of _g_e_t_d_t_a_b_l_e_s_i_z_e(2) was intended to
  100.      allow user programs to be written independent of the kernel
  101.      limit on the number of open files, the dimension of a suffi-
  102.      ciently large bit field for select remains a problem.  The
  103.      default size FD_SETSIZE (currently 256) is somewhat larger
  104.      than the current kernel limit to the number of open files.
  105.      However, in order to accommodate programs which might poten-
  106.      tially use a larger number of open files with select, it is
  107.      possible to increase this size within a program by providing
  108.      a larger definition of FD_SETSIZE before the inclusion of
  109.      <sys/types.h>.
  110.  
  111.      _S_e_l_e_c_t should probably return the time remaining from the
  112.      original timeout, if any, by modifying the time value in
  113.      place.  This may be implemented in future versions of the
  114.      system.  Thus, it is unwise to assume that the timeout value
  115.      will be unmodified by the _s_e_l_e_c_t call.
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 15, 1986                          2
  130.  
  131.  
  132.  
  133.